import React, { Component } from "react";
import Tabbar from "./components/tabbar/Tabbar";
import { HashRouter as Router, Route,  Redirect,Switch } from "react-router-dom";
import Home from "./components/home/Home"
import Category from "./components/category/Category"
import Cart from "./components/cart/Cart"
import My from "./components/my/My"
import Test from "./components/test/Test";
import SearchCenter from "./components/searchCenter/SearchCenter";
import GoodDetail from "./components/goodDetail/GoodDetail"
import GoodList from "./components/goodList/GoodList";

export default class App extends Component {
  render() {
    return (
      <div>
        <Router>
          <Switch>
            <Route exact path="/home" render={(props)=><Tabbar {...props}><Home></Home></Tabbar>}></Route>
            <Route exact path="/category" render={(props)=><Tabbar {...props}><Category></Category></Tabbar>}></Route>
            <Route exact path="/cart" render={(props)=><Tabbar {...props}><Cart></Cart></Tabbar>}></Route>
            <Route exact path="/my" render={(props)=><Tabbar {...props}><My></My></Tabbar>}></Route>
            <Route exact path="/test" render={(props)=><Test></Test>}></Route>
            <Route exact path="/searchCenter" render={(props)=><SearchCenter></SearchCenter>}></Route>
            <Route exact path="/goodDetail/:goods_id" render={(props)=><GoodDetail></GoodDetail>}></Route>
            <Route exact path="/goodList" render={(props)=><GoodList {...props}></GoodList>}></Route>
            <Redirect to="/home"></Redirect>
          </Switch>
        </Router>
      </div>
    );
  }
}
